﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;

using SBPweb.RIA.Client.Controls.Extensions;

using SBPweb.PlAzureNet.Client.Library.Controllers;

namespace SBPweb.PlAzureNet.Client.Presenter.Pages
{

    public partial class RootPage : UserControl, IModulesRootPage
    {

        public RootPage()
        {
            InitializeComponent();
        }
        
        public void PlaceModuleEntryControl(UserControl entryControl, ControlPlacements placement, string placementArgument)
        {
            switch (placement)
            {
                default:
                case ControlPlacements.Grid:
                    LayoutControlRoot.Children.Add(entryControl);
                    break;
                case ControlPlacements.Canvas:
                    WindowsRootPanel.Children.Add(entryControl);
                    break;
                case ControlPlacements.PlaceHolder:
                    ContentPresenter cp = this.FindChildElement<ContentPresenter>(placementArgument);
                    cp.Content = entryControl;
                    break;
            }
        }

    }

}